One way to increase the performance of a computer system is to increase the data transfer rate of the memory used in the system. However, the cost of memory increases dramatically with the speed of the memory. Thus, it is rarely practical to use the fastest memory available, especially in systems which require large quantities of memory. Consequently, it has been discovered that by using a relatively small bank of relatively high-speed memory ("cache memory") as a buffer for a larger bank of slower memory ("system memory"), system performance can be greatly improved. For example, magnetic media, such as "hard disks", provide much less expensive, but much slower storage than random access memory ("RAM"). By allocating a relatively small portion of RAM to function as a cache memory between a hard disk and a microprocessor, the time required for operations which access data stored on the hard disk can be significantly decreased.
The data transfers between the system memory and cache memory are controlled by a cache controller. A cache controller manages the cache memory based upon the needs of the microprocessor. For example, if the microprocessor requires information that is not currently stored in the cache memory, the data must be transferred from the slower system memory to the cache memory before it may be accessed by the microprocessor. If all of the cache memory blocks are allocated, then the cache controller must determine which data in the cache memory should be stored back to the system memory to allow storage space for the new memory.
Cache controllers may generally be implemented in hardware or software. The disadvantage of software implemented cache controllers is that they generally require valuable resources. For example, a software-implemented hard disk cache typically requires RAM for a cache buffer, RAM for cache controller instructions, and processing time to execute the controller instructions. The RAM used for the cache memory and controller instructions would otherwise have been available for use by an application. Likewise, the processing time of the cache controller would otherwise have been available for the execution of an application. Because the software cache controller and applications must compete for the same resources, overall system performance is diminished.
Consequently, microprocessors have been developed which include built-in cache memory and cache controller hardware. By building the cache memory and control hardware directly into a microprocessor, users may benefit from the increased performance provided by cache without having to add cache control code to their software. In fact, because the cache memory control is handled entirely by built-in hardware, cache operations are virtually transparent to a user. Further, the hardware cache control does not compete with applications for the processing and storage resources of the system.
However, for some applications it would be desirable to customize the operation of a hardware cache controller to improve the performance of an application. For example, the caching of data associated with special devices, such as graphics devices, is not possible using the generic caching provided by hardware cache controllers. Since current built-in hardware cache controllers are independent of and inaccessible to software, such application-specific cache control customization is not possible. It is therefore clearly desirable to provide a hardware cache controller that can operate transparent to a user, but which further allows a user to modify or affect cache control operations. It is further desirable to provide a cache controller that allows data associated with special devices to be cached.